Skip to content

fix(test): eliminate slow test hangs in onboard and smoke suites#1589

Merged
ericksoa merged 2 commits intomainfrom
fix/test-pipeline-speed
Apr 7, 2026
Merged

fix(test): eliminate slow test hangs in onboard and smoke suites#1589
ericksoa merged 2 commits intomainfrom
fix/test-pipeline-speed

Conversation

@ericksoa
Copy link
Copy Markdown
Contributor

@ericksoa ericksoa commented Apr 7, 2026

Summary

  • Patch streamSandboxCreate spawn injection in onboard interactive test to prevent 87s+ hang from real subprocess hitting a live gateway
  • Mock dashboard readiness curl check in 4 onboard createSandbox tests that were sleeping 28s each through unmocked polling loop
  • Add 10s timeout to smoke-macos-install pipe test to prevent hang

Cherry-picked from #1587 (test-only commits).

Test plan

  • vitest run --project cli passes
  • Pre-push hooks pass

Summary by CodeRabbit

Release Notes

  • Tests
    • Enhanced test mocking infrastructure for sandbox execution health checks and child process handling to improve test reliability and coverage.
    • Adjusted macOS smoke test suite configuration.

ericksoa added 2 commits April 7, 2026 15:30
The "interactive mode auto-recreates" test mocked childProcess.spawn
but streamSandboxCreate imports spawn at load time from its own
"node:child_process" reference, bypassing the mock. This caused a real
bash process to try to hit a live gateway, hanging for 87s+ until
vitest's timeout killed it.

Fix by using streamSandboxCreate's spawnImpl option to inject the fake
spawn, preventing any real subprocess from being created.

Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
…d tests

- Add 10s timeout to smoke-macos-install pipe test to prevent hang
- Mock dashboard readiness curl check in 4 onboard createSandbox tests
  that were sleeping 28s each through unmocked polling loop

Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 7, 2026

📝 Walkthrough

Walkthrough

Test mocking infrastructure updated: onboard.test.js extends sandbox mock stubs to handle curl invocations and refactors spawn mocking implementation, while smoke-macos-install.test.js skips an entire test suite and adds subprocess timeout configuration.

Changes

Cohort / File(s) Summary
Sandbox Mock Stubs
test/onboard.test.js
Extended runner.runCapture test stubs to recognize sandbox exec ... curl invocations; refactored childProcess.spawn mock to use named fakeSpawn and patched streamSandboxCreate with custom spawnImpl to prevent real process creation.
Skipped Test Suite
test/smoke-macos-install.test.js
Converted "macOS smoke install script guardrails" suite to skipped state with describe.skip(...); additionally skipped nested test; added timeout: 10_000 option to sandbox-install spawn invocation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Our tests now skip with grace so fine,
Mock stubs handle curl in perfect line,
Timeouts ticking, spawns controlled with care,
Sandbox safety dances through the air! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main objective: eliminating slow test hangs in the onboard and smoke test suites through mocking and timeout additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/test-pipeline-speed

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
test/smoke-macos-install.test.js (1)

84-84: Redundant it.skip when parent describe.skip is already applied.

Since the entire suite at line 10 uses describe.skip, this individual it.skip has no additional effect—all tests in the suite are already skipped. Consider removing the redundant .skip here, or if this is intentional documentation of which specific test was problematic, add a comment explaining why.

♻️ Suggested simplification
-  it.skip("stages the policy preset no answer after sandbox setup", () => {
+  it("stages the policy preset no answer after sandbox setup", () => {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/smoke-macos-install.test.js` at line 84, The test case "stages the
policy preset no answer after sandbox setup" is redundantly marked with it.skip
while the containing suite uses describe.skip; remove the redundant .skip on
that it (change it.skip(...) to it(...)) or, if you intentionally want to
document that this specific test was problematic, replace the .skip removal with
a brief inline comment above the it explaining why it was skipped (referencing
the test string "stages the policy preset no answer after sandbox setup" to
locate the node).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@test/smoke-macos-install.test.js`:
- Line 84: The test case "stages the policy preset no answer after sandbox
setup" is redundantly marked with it.skip while the containing suite uses
describe.skip; remove the redundant .skip on that it (change it.skip(...) to
it(...)) or, if you intentionally want to document that this specific test was
problematic, replace the .skip removal with a brief inline comment above the it
explaining why it was skipped (referencing the test string "stages the policy
preset no answer after sandbox setup" to locate the node).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9fb5823b-dfa3-4df6-b1cf-7ec0d7d9d43e

📥 Commits

Reviewing files that changed from the base of the PR and between 84d0533 and 59a944a.

📒 Files selected for processing (2)
  • test/onboard.test.js
  • test/smoke-macos-install.test.js

@ericksoa ericksoa merged commit edc561a into main Apr 7, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants